package main.java;

public class EAMD5
{
  int[] r1Shifts;
  int[] r2Shifts;
  int[] r3Shifts;
  int[] r4Shifts;

  public EAMD5()
  {
    int[] arrayOfInt1 = new int[16];
    arrayOfInt1[0] = 7;
    arrayOfInt1[1] = 12;
    arrayOfInt1[2] = 17;
    arrayOfInt1[3] = 22;
    arrayOfInt1[4] = 7;
    arrayOfInt1[5] = 12;
    arrayOfInt1[6] = 17;
    arrayOfInt1[7] = 22;
    arrayOfInt1[8] = 7;
    arrayOfInt1[9] = 12;
    arrayOfInt1[10] = 17;
    arrayOfInt1[11] = 22;
    arrayOfInt1[12] = 7;
    arrayOfInt1[13] = 12;
    arrayOfInt1[14] = 17;
    arrayOfInt1[15] = 22;
    this.r1Shifts = arrayOfInt1;
    int[] arrayOfInt2 = new int[16];
    arrayOfInt2[0] = 5;
    arrayOfInt2[1] = 9;
    arrayOfInt2[2] = 14;
    arrayOfInt2[3] = 20;
    arrayOfInt2[4] = 5;
    arrayOfInt2[5] = 9;
    arrayOfInt2[6] = 14;
    arrayOfInt2[7] = 20;
    arrayOfInt2[8] = 5;
    arrayOfInt2[9] = 9;
    arrayOfInt2[10] = 14;
    arrayOfInt2[11] = 20;
    arrayOfInt2[12] = 5;
    arrayOfInt2[13] = 9;
    arrayOfInt2[14] = 14;
    arrayOfInt2[15] = 20;
    this.r2Shifts = arrayOfInt2;
    int[] arrayOfInt3 = new int[16];
    arrayOfInt3[0] = 4;
    arrayOfInt3[1] = 11;
    arrayOfInt3[2] = 16;
    arrayOfInt3[3] = 23;
    arrayOfInt3[4] = 4;
    arrayOfInt3[5] = 11;
    arrayOfInt3[6] = 16;
    arrayOfInt3[7] = 23;
    arrayOfInt3[8] = 4;
    arrayOfInt3[9] = 11;
    arrayOfInt3[10] = 16;
    arrayOfInt3[11] = 23;
    arrayOfInt3[12] = 4;
    arrayOfInt3[13] = 11;
    arrayOfInt3[14] = 16;
    arrayOfInt3[15] = 23;
    this.r3Shifts = arrayOfInt3;
    int[] arrayOfInt4 = new int[16];
    arrayOfInt4[0] = 6;
    arrayOfInt4[1] = 10;
    arrayOfInt4[2] = 15;
    arrayOfInt4[3] = 21;
    arrayOfInt4[4] = 6;
    arrayOfInt4[5] = 10;
    arrayOfInt4[6] = 15;
    arrayOfInt4[7] = 21;
    arrayOfInt4[8] = 6;
    arrayOfInt4[9] = 10;
    arrayOfInt4[10] = 15;
    arrayOfInt4[11] = 21;
    arrayOfInt4[12] = 6;
    arrayOfInt4[13] = 10;
    arrayOfInt4[14] = 15;
    arrayOfInt4[15] = 21;
    this.r4Shifts = arrayOfInt4;
  }

  int add(int paramInt1, int paramInt2)
  {
    int i = (paramInt1 & 0xFFFF) + (paramInt2 & 0xFFFF);
    return (paramInt1 >> 16) + (paramInt2 >> 16) + (i >> 16) << 16 | i & 0xFFFF;
  }

  int bitwiseRotate(int paramInt1, int paramInt2)
  {
    return paramInt1 << paramInt2 | paramInt1 >>> 32 - paramInt2;
  }

  int[] chunkMessage(String paramString)
  {
    int i = 1 + (8 + paramString.length() >> 6);
    int[] arrayOfInt = new int[i * 16];
    for (int j = 0; ; j++)
    {
      if (j >= paramString.length())
      {
        int m = j >> 2;
        arrayOfInt[m] |= 128 << 8 * (j % 4);
        arrayOfInt[(-2 + i * 16)] = (8 * paramString.length());
        return arrayOfInt;
      }
      int k = j >> 2;
      arrayOfInt[k] |= paramString.charAt(j) << 8 * (j % 4);
    }
  }

  int cmn(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6)
  {
    return add(bitwiseRotate(add(add(paramInt2, paramInt1), add(paramInt4, paramInt6)), paramInt5), paramInt3);
  }

  public String md5(String paramString)
  {
    int[] arrayOfInt = chunkMessage(paramString);
    int i = 1732584193;
    int j = -271733879;
    int k = -1732584194;
    int m = 271733878;
    for (int n = 0; ; n += 16)
    {
      if (n >= arrayOfInt.length)
        return numToHex(i) + numToHex(j) + numToHex(k) + numToHex(m);
      int i1 = i;
      int i2 = j;
      int i3 = k;
      int i4 = m;
      int i5 = md5_f(i, j, k, m, arrayOfInt[(n + 0)], this.r1Shifts[0], -680876936);
      int i6 = arrayOfInt[(n + 1)];
      int i7 = this.r1Shifts[1];
      int i8 = md5_f(m, i5, j, k, i6, i7, -389564586);
      int i9 = arrayOfInt[(n + 2)];
      int i10 = this.r1Shifts[2];
      int i11 = md5_f(k, i8, i5, j, i9, i10, 606105819);
      int i12 = arrayOfInt[(n + 3)];
      int i13 = this.r1Shifts[3];
      int i14 = md5_f(j, i11, i8, i5, i12, i13, -1044525330);
      int i15 = md5_f(i5, i14, i11, i8, arrayOfInt[(n + 4)], this.r1Shifts[4], -176418897);
      int i16 = md5_f(i8, i15, i14, i11, arrayOfInt[(n + 5)], this.r1Shifts[5], 1200080426);
      int i17 = md5_f(i11, i16, i15, i14, arrayOfInt[(n + 6)], this.r1Shifts[6], -1473231341);
      int i18 = md5_f(i14, i17, i16, i15, arrayOfInt[(n + 7)], this.r1Shifts[7], -45705983);
      int i19 = md5_f(i15, i18, i17, i16, arrayOfInt[(n + 8)], this.r1Shifts[8], 1770035416);
      int i20 = md5_f(i16, i19, i18, i17, arrayOfInt[(n + 9)], this.r1Shifts[9], -1958414417);
      int i21 = md5_f(i17, i20, i19, i18, arrayOfInt[(n + 10)], this.r1Shifts[10], -42063);
      int i22 = md5_f(i18, i21, i20, i19, arrayOfInt[(n + 11)], this.r1Shifts[11], -1990404162);
      int i23 = md5_f(i19, i22, i21, i20, arrayOfInt[(n + 12)], this.r1Shifts[12], 1804603682);
      int i24 = md5_f(i20, i23, i22, i21, arrayOfInt[(n + 13)], this.r1Shifts[13], -40341101);
      int i25 = md5_f(i21, i24, i23, i22, arrayOfInt[(n + 14)], this.r1Shifts[14], -1502002290);
      int i26 = md5_f(i22, i25, i24, i23, arrayOfInt[(n + 15)], this.r1Shifts[15], 1236535329);
      int i27 = md5_g(i23, i26, i25, i24, arrayOfInt[(n + 1)], this.r2Shifts[0], -165796510);
      int i28 = md5_g(i24, i27, i26, i25, arrayOfInt[(n + 6)], this.r2Shifts[1], -1069501632);
      int i29 = md5_g(i25, i28, i27, i26, arrayOfInt[(n + 11)], this.r2Shifts[2], 643717713);
      int i30 = md5_g(i26, i29, i28, i27, arrayOfInt[(n + 0)], this.r2Shifts[3], -373897302);
      int i31 = md5_g(i27, i30, i29, i28, arrayOfInt[(n + 5)], this.r2Shifts[4], -701558691);
      int i32 = md5_g(i28, i31, i30, i29, arrayOfInt[(n + 10)], this.r2Shifts[5], 38016083);
      int i33 = md5_g(i29, i32, i31, i30, arrayOfInt[(n + 15)], this.r2Shifts[6], -660478335);
      int i34 = md5_g(i30, i33, i32, i31, arrayOfInt[(n + 4)], this.r2Shifts[7], -405537848);
      int i35 = md5_g(i31, i34, i33, i32, arrayOfInt[(n + 9)], this.r2Shifts[8], 568446438);
      int i36 = md5_g(i32, i35, i34, i33, arrayOfInt[(n + 14)], this.r2Shifts[9], -1019803690);
      int i37 = md5_g(i33, i36, i35, i34, arrayOfInt[(n + 3)], this.r2Shifts[10], -187363961);
      int i38 = md5_g(i34, i37, i36, i35, arrayOfInt[(n + 8)], this.r2Shifts[11], 1163531501);
      int i39 = md5_g(i35, i38, i37, i36, arrayOfInt[(n + 13)], this.r2Shifts[12], -1444681467);
      int i40 = md5_g(i36, i39, i38, i37, arrayOfInt[(n + 2)], this.r2Shifts[13], -51403784);
      int i41 = md5_g(i37, i40, i39, i38, arrayOfInt[(n + 7)], this.r2Shifts[14], 1735328473);
      int i42 = md5_g(i38, i41, i40, i39, arrayOfInt[(n + 12)], this.r2Shifts[15], -1926607734);
      int i43 = md5_h(i39, i42, i41, i40, arrayOfInt[(n + 5)], this.r3Shifts[0], -378558);
      int i44 = md5_h(i40, i43, i42, i41, arrayOfInt[(n + 8)], this.r3Shifts[1], -2022574463);
      int i45 = md5_h(i41, i44, i43, i42, arrayOfInt[(n + 11)], this.r2Shifts[2], 1839030562);
      int i46 = md5_h(i42, i45, i44, i43, arrayOfInt[(n + 14)], this.r3Shifts[3], -35309556);
      int i47 = md5_h(i43, i46, i45, i44, arrayOfInt[(n + 1)], this.r3Shifts[4], -1530992060);
      int i48 = md5_h(i44, i47, i46, i45, arrayOfInt[(n + 4)], this.r3Shifts[5], 1272893353);
      int i49 = md5_h(i45, i48, i47, i46, arrayOfInt[(n + 7)], this.r3Shifts[6], -155497632);
      int i50 = md5_h(i46, i49, i48, i47, arrayOfInt[(n + 10)], this.r3Shifts[7], -1094730640);
      int i51 = md5_h(i47, i50, i49, i48, arrayOfInt[(n + 13)], this.r3Shifts[8], 681279174);
      int i52 = md5_h(i48, i51, i50, i49, arrayOfInt[(n + 0)], this.r3Shifts[9], -358537222);
      int i53 = md5_h(i49, i52, i51, i50, arrayOfInt[(n + 3)], this.r3Shifts[10], -722521979);
      int i54 = md5_h(i50, i53, i52, i51, arrayOfInt[(n + 6)], this.r3Shifts[11], 76029189);
      int i55 = md5_h(i51, i54, i53, i52, arrayOfInt[(n + 9)], this.r3Shifts[12], -640364487);
      int i56 = md5_h(i52, i55, i54, i53, arrayOfInt[(n + 12)], this.r3Shifts[13], -421815835);
      int i57 = md5_h(i53, i56, i55, i54, arrayOfInt[(n + 15)], this.r3Shifts[14], 530742520);
      int i58 = md5_h(i54, i57, i56, i55, arrayOfInt[(n + 2)], this.r3Shifts[15], -995338651);
      int i59 = md5_i(i55, i58, i57, i56, arrayOfInt[(n + 0)], this.r4Shifts[0], -198630844);
      int i60 = md5_i(i56, i59, i58, i57, arrayOfInt[(n + 7)], this.r4Shifts[1], 1126891415);
      int i61 = md5_i(i57, i60, i59, i58, arrayOfInt[(n + 14)], this.r4Shifts[2], -1416354905);
      int i62 = md5_i(i58, i61, i60, i59, arrayOfInt[(n + 5)], this.r4Shifts[3], -57434055);
      int i63 = md5_i(i59, i62, i61, i60, arrayOfInt[(n + 12)], this.r4Shifts[4], 1700485571);
      int i64 = md5_i(i60, i63, i62, i61, arrayOfInt[(n + 3)], this.r4Shifts[5], -1894986606);
      int i65 = md5_i(i61, i64, i63, i62, arrayOfInt[(n + 10)], this.r4Shifts[6], -1051523);
      int i66 = md5_i(i62, i65, i64, i63, arrayOfInt[(n + 1)], this.r4Shifts[7], -2054922799);
      int i67 = md5_i(i63, i66, i65, i64, arrayOfInt[(n + 8)], this.r4Shifts[8], 1873313359);
      int i68 = md5_i(i64, i67, i66, i65, arrayOfInt[(n + 15)], this.r4Shifts[9], -30611744);
      int i69 = md5_i(i65, i68, i67, i66, arrayOfInt[(n + 6)], this.r4Shifts[10], -1560198380);
      int i70 = md5_i(i66, i69, i68, i67, arrayOfInt[(n + 13)], this.r4Shifts[11], 1309151649);
      int i71 = md5_i(i67, i70, i69, i68, arrayOfInt[(n + 4)], this.r4Shifts[12], -145523070);
      int i72 = md5_i(i68, i71, i70, i69, arrayOfInt[(n + 11)], this.r4Shifts[13], -1120210379);
      int i73 = md5_i(i69, i72, i71, i70, arrayOfInt[(n + 2)], this.r4Shifts[14], 718787259);
      int i74 = md5_i(md5_i(i70, i73, i72, i71, arrayOfInt[(n + 9)], this.r4Shifts[15], -343485551), i73, i72, i71, arrayOfInt[(n + 9)], this.r4Shifts[15], -343485551);
      i = add(i71, i1);
      j = add(i74, i2);
      k = add(i73, i3);
      m = add(i72, i4);
    }
  }

  int md5_f(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, int paramInt7)
  {
    return cmn(paramInt2 & paramInt3 | paramInt4 & (paramInt2 ^ 0xFFFFFFFF), paramInt1, paramInt2, paramInt5, paramInt6, paramInt7);
  }

  int md5_g(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, int paramInt7)
  {
    return cmn(paramInt2 & paramInt4 | paramInt3 & (paramInt4 ^ 0xFFFFFFFF), paramInt1, paramInt2, paramInt5, paramInt6, paramInt7);
  }

  int md5_h(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, int paramInt7)
  {
    return cmn(paramInt4 ^ (paramInt2 ^ paramInt3), paramInt1, paramInt2, paramInt5, paramInt6, paramInt7);
  }

  int md5_i(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, int paramInt7)
  {
    return cmn(paramInt3 ^ (paramInt2 | paramInt4 ^ 0xFFFFFFFF), paramInt1, paramInt2, paramInt5, paramInt6, paramInt7);
  }

  String numToHex(int paramInt)
  {
    for (String str = Integer.toHexString(paramInt); ; str = "0" + str)
      if (str.length() >= 8)
        return str.substring(6, 8) + str.substring(4, 6) + str.substring(2, 4) + str.substring(0, 2);
  }
}